<template>
	<view class="container">
		<view class="set-items">
			<view class="set-item" @click="jump('/pages/center/account-info')">
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/user/set-info.png" mode="widthFix"
					class="item-img"></image>
				<view class="center">账号信息</view>
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/common/more-grey.png" mode="widthFix"
					class="more-img"></image>
			</view>
			<!-- #ifdef APP-PLUS -->
			<view class="set-item" @click="jump('/pages/center/password')">
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/user/set-pass.png" mode="widthFix"
					class="item-img"></image>
				<view class="center">登录密码修改</view>
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/common/more-grey.png" mode="widthFix"
					class="more-img"></image>
			</view>
			<!-- #endif -->

			<view class="set-item" @click="jump('/pages/center/paypwd')">
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/user/set-paypwd.png" mode="widthFix"
					class="item-img"></image>
				<view class="center">交易密码修改</view>
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/common/more-grey.png" mode="widthFix"
					class="more-img"></image>
			</view>
			<view class="set-item" @click="jump('/pages/center/with-account')">
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/user/set-with.png" mode="widthFix"
					class="item-img"></image>
				<view class="center">提现账户</view>
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/common/more-grey.png" mode="widthFix"
					class="more-img"></image>
			</view>
			<view class="set-item" @click="toAbout">
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/user/set-about.png" mode="widthFix"
					class="item-img"></image>
				<view class="center">关于我们</view>
				<image src="https://farm-city.oss-cn-hangzhou.aliyuncs.com/static/common/more-grey.png" mode="widthFix"
					class="more-img"></image>
			</view>
		</view>
		<!-- #ifdef APP-PLUS -->
		<button class="logout-btn" @click="tuichu">退出登录</button>
		<!-- #endif -->

		<u-popup :safeAreaInsetBottom="false" :safeAreaInsetTop="false" mode="center" :show="show" round="5"
			:overlay="true" :customStyle="customStyle1" @close="close">
			<view class="u-popup-slot">
				<text class="u-popup-slot_text">确认退出登录？</text>
				<view class="u-popup-slot_flex">
					<button @click="show = !show" class="cancel">取消</button>
					<button @click="logout()" class="confirm">确认</button>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				show: false,
				customStyle1: {
					'width': '80%'
				},
			};
		},
		methods: {
			toAbout() {
				this.$u.route({
					url: '/pages/index/html-detail',
					params: {
						title: '关于我们',
						url: encodeURIComponent('/api/xieyi_xq?id=3')
					}
				})
			},
			tuichu() {
				_this.show = true
			},
			//退出登录
			logout() {
				this.$u.toast('退出成功')
				setTimeout(() => {
					//清除缓存的token和用户信息
					_this.$u.vuex('user_id', 0)
					_this.$u.vuex('user_token', getApp().globalData.default_token)
					uni.reLaunch({
						url: '/pages/auth/login'
					})
					_this.show = false
					_this.user = {}
				}, 2000)
			},
			jump(url) {
				uni.navigateTo({
					url
				})
			}
		},
		onLoad(e) {
			_this = this;
		},
		onShow() {

		},
		components: {}
	}
</script>

<style lang="scss" scoped>
	@import "@/static/css/form.scss";

	.container {
		.logout-btn {
			margin-top: 40rpx;
			height: 88rpx;
			line-height: 88rpx;
			border-radius: 50rpx;
			color: $theme-color;
			font-size: 30rpx;
			background: #fff;
		}
	}
</style>